<template>
    <div>
        <h3>当前的count值为：{{ $store.state.count }}</h3>
        <h2>{{ $store.getters.showCount }}</h2>
        <button @click="addBtn">+1</button>
        <br>
        <button @click="addnBtn">+2</button>
        <br>
        <button @click="addNStore">+3</button>
        <br>
        <button @click="addN(4)">async +4</button>
    </div>
</template>
<script>
import { mapMutations } from 'vuex'
export default {
    data(){
        return {
            
        }
    },
    methods:{
        addBtn(){
            this.$store.commit('add')
        },
        addnBtn(){
            this.$store.commit('addN',2)
        },
        ...mapMutations(['add','addN']),
        addNStore(){
            this.addN(3);
        },
        addAsync(){
            this.$store.dispatch('addAsync');
        }
    }
}
</script>
<style lang="less" scoped>

</style>